#!/bin/bash
devices=( `motelist | grep -o ".dev/.*[0-9]"` )
for ((i=0;i<${#devices[@]};i++));do
	if [ $1 = "-sink" ]; then
		if [ $i -eq $2 ]; then
			sink=$2
			gnome-terminal -e "bash ./printClient.sh ${devices[i]} $sink" &
		else
			gnome-terminal -e "bash ./printClient.sh ${devices[i]}" &
		fi
	else	
		gnome-terminal -e "bash ./printClient.sh ${devices[i]}" &
	fi
			
	
done;




#non più utile
#string='oiu /dev/ttyUSB0 iuytr'
#sub=`expr match "$string" '\(.*dev.*[ ]\)'`
#device=`expr match "$sub" '.*\(/dev.*\)'`


